type CalcFnType = (num1: number, num2: number) => number

function foo(a: string, b: number, c: boolean) {
    return "abc"
}

// 类型体操手写 ReturnType
type MyReturnType<T extends (...args: any) => any> = T extends (...args: any) => infer R ? R : any

// 获取一个函数的返回值类型：内置工具
type CalcReturnType = ReturnType<CalcFnType>
type FooReturnType = ReturnType<typeof foo>
type FooReturnType2 = MyReturnType<typeof foo>


type MyParameterType<T extends (...args: any) => any> = T extends (...args: infer A) => any ? A : any
type FooReturnType3 = MyParameterType<typeof foo>
type CalcReturnType2 = MyParameterType<CalcFnType>


export { }